import axios from 'axios'

export function getNews() {
  return axios.get('/api/news/list').then(res => res.data)
}

export function getNewsById(id) {
  return axios.get(`/api/news/detail?id=${id}`).then(res => res.data)
}

export function createNews(data) {
  return axios.post('/api/news/create', data).then(res => res.data)
}

export function updateNews(data) {
  return axios.put('/api/news/update', data).then(res => res.data)
}

export function deleteNews(id) {
  return axios.delete(`/api/news/delete?id=${id}`).then(res => res.data)
} 